<?php
namespace kernel;

class Http
{
    public static function onWorkerStart($worker){
        require_once dirname(__DIR__, 1).DIRECTORY_SEPARATOR.'boot'.DIRECTORY_SEPARATOR.'initialize'.DIRECTORY_SEPARATOR.'http.php';
    }
    
    public static function onConnect($connection){
        //echo "新建连接,IP:" . $connection->getRemoteIp() . "\n";
    }
    
    public static function onMessage($connection, $request) {
        $response = (new \kernel\library\App())->http()->run($request);
        $connection->send($response);
        
    }
    
    public static function onClose($connection){
    }
    
    public static function onWorkerStop($connection){
        
    }
    
}

